package boogui.movie;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class S_ReservationChkDialog extends JDialog {
	
	MovieService ms = null;
//	BtnActionListener bal = null;
	

	static final JPanel contentPanel = new JPanel();	

	/**
	 * Launch the application.
	 */
	/*public static void main(String[] args) {
		try {
			S_ReservationChkDialog dialog = new S_ReservationChkDialog(new MovieVO());
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}*/

	/**
	 * Create the dialog.
	 */
	public S_ReservationChkDialog(MovieVO m) {
		
		setModal(true);
		ms = new MovieService();
//		bal = new BtnActionListener();
		setTitle("예매 확인");
		setBounds(100, 100, 600, 218);
		setLocationRelativeTo(null);
		setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/images/menu/rcheck.png")));
		getContentPane().setLayout(new BorderLayout());			
		{
			JPanel panel_2 = new JPanel();
			panel_2.setPreferredSize(new Dimension(120, 10));
			getContentPane().add(panel_2, BorderLayout.WEST);
			{
				JLabel lblNewLabel_2 = new JLabel();
				ms.readPosterImage(m.getMovtitle(), lblNewLabel_2, 118, 170);
				panel_2.add(lblNewLabel_2);
			}
		}
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPanel.setLayout(new BorderLayout(0, 0));
		{
			JPanel panel = new JPanel();
			FlowLayout flowLayout = (FlowLayout) panel.getLayout();
			flowLayout.setHgap(30);
			flowLayout.setAlignment(FlowLayout.LEFT);
			contentPanel.add(panel, BorderLayout.NORTH);
			{
				JLabel lblNewLabel = new JLabel(m.getMovtitle());
				lblNewLabel.setFont(new Font("맑은 고딕", Font.BOLD, 18));
				panel.add(lblNewLabel);
			}
		}
		JPanel panel = new JPanel();
		contentPanel.add(panel, BorderLayout.CENTER);
		panel.setLayout(new GridLayout(4, 1, 0, 0));
		
		String date = m.getSdate().substring(0, 4) + "년  " + m.getSdate().substring(4,6) + "월  "
				+ m.getSdate().substring(6, m.getSdate().length()) + "일      " + m.getStime();
		JLabel lblNewLabel_1 = new JLabel(date);
		panel.add(lblNewLabel_1);
		
		
		String people = m.getUserrate() + "   " + m.getPeoplenum();
		JLabel lblNewLabel_6 = new JLabel(people);
		panel.add(lblNewLabel_6);
		{
			JLabel lblNewLabel_3 = new JLabel(m.getCinename() + " " + m.getTheater());
			panel.add(lblNewLabel_3);
		}
		{
			JLabel lblNewLabel_4 = new JLabel(m.getSeat());
			panel.add(lblNewLabel_4);
		}
		{
			JPanel buttonPane = new JPanel();
			contentPanel.add(buttonPane, BorderLayout.SOUTH);
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			{
				JLabel lblNewLabel_5 = new JLabel("예매 하시겠습니까?");
				lblNewLabel_5.setFont(new Font("맑은 고딕", Font.PLAIN, 14));
				buttonPane.add(lblNewLabel_5);
			}
			{
				JButton okButton = new JButton("확 인");
				/*okButton.addMouseListener(new MouseAdapter() {					
					@Override
					public void mouseReleased(MouseEvent e) {
						setVisible(false);
						dispose();
					}
				});*/
				okButton.addActionListener(S_MovieSeatDialog.al);
				okButton.setActionCommand("OKOK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("취 소");
				cancelButton.addActionListener(new ActionListener() {					
					@Override
					public void actionPerformed(ActionEvent e) {
						setVisible(false);
						dispose();
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
		{
			JPanel panel_1 = new JPanel();
			panel_1.setPreferredSize(new Dimension(50, 10));
			contentPanel.add(panel_1, BorderLayout.WEST);
		}
		setVisible(true);
	}	

	

	private class BtnActionListener implements ActionListener {
	
		@Override
		public void actionPerformed(ActionEvent e) {
			switch(e.getActionCommand()) {
			case "OK":				
				
				break;
			}
			
		}
	}	
}
